﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Resume.Data.Model;

namespace Resume.Data.Mappers
{
    public class EducationMapper : EntityTypeConfiguration<Education>
    {
        public EducationMapper()
        {
            this.ToTable("Educations");

            this.HasKey(p => p.Id);
            this.Property(p => p.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            this.Property(p => p.Id).IsRequired();

            this.Property(p => p.Name).IsOptional();
            this.Property(p => p.Name).HasMaxLength(100);

            this.Property(p => p.Address).IsOptional();
            this.Property(p => p.Address).HasMaxLength(100);

            this.Property(p => p.City).IsOptional();
            this.Property(p => p.City).HasMaxLength(50);

            this.Property(p => p.State).IsOptional();
            this.Property(p => p.State).HasMaxLength(10);

            this.Property(p => p.Degree).IsOptional();
            this.Property(p => p.Degree).HasMaxLength(50);

        }
    }
}
